using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Decisions.HL7.Message;
using DecisionsFramework;

namespace Decisions.HL7.Message
{
    public class StatusofEvaluationAttribute:RuleAttribute
    {
        private Dictionary<HL7Version, string[]> validVersionCodes = new Dictionary<HL7Version, string[]>();
        private Dictionary<HL7Version, string[]> validVersionDescriptions = new Dictionary<HL7Version, string[]>();
        private Dictionary<HL7Version, HL7TableType> tableVersionTypes = new Dictionary<HL7Version, HL7TableType>();

        public StatusofEvaluationAttribute()
        {
            // init the values for table version types
						tableVersionTypes[HL7Version.v23] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v231] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v24] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v25] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v251] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v26] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v27] = HL7TableType.HL7;
			
            
			// init the values for version codes
						validVersionCodes[HL7Version.v23] = new string[]{"A","C","D","I","K","O","P","Q","R","U","X","Y"};
						validVersionCodes[HL7Version.v231] = new string[]{"Y","P","K","X","A","D","C","I","U","Q","R","O"};
						validVersionCodes[HL7Version.v24] = new string[]{"Y","P","K","X","A","D","C","I","U","Q","R","O"};
						validVersionCodes[HL7Version.v25] = new string[]{"Y","P","K","X","A","D","C","I","U","Q","R","O"};
						validVersionCodes[HL7Version.v251] = new string[]{"Y","P","K","X","A","D","C","I","U","Q","R","O"};
						validVersionCodes[HL7Version.v26] = new string[]{"Y","P","K","X","A","D","C","I","U","Q","R","O"};
						validVersionCodes[HL7Version.v27] = new string[]{"Y","P","K","X","A","D","C","I","U","Q","R","O"};
			
			// init the values for version descriptions
						validVersionDescriptions[HL7Version.v23] = new string[]{"Evaluation anticipated, but not yet begun","Product received in condition which made analysis impossible","Product discarded -- unable to follow up","Product remains implanted -- unable to follow up","Problem already known, no evaluation necessary","Other","Evaluation in progress","Product under quarantine -- unable to follow up","Product under recall/corrective action","Product unavailable for follow up investigation","Product not made by company","Evaluation completed"};
						validVersionDescriptions[HL7Version.v231] = new string[]{"Evaluation completed","Evaluation in progress","Problem already known, no evaluation necessary","Product not made by company","Evaluation anticipated, but not yet begun","Product discarded -- unable to follow up","Product received in condition which made analysis impossible","Product remains implanted -- unable to follow up","Product unavailable for follow up investigation","Product under quarantine -- unable to follow up","Product under recall/corrective action","Other"};
						validVersionDescriptions[HL7Version.v24] = new string[]{"Evaluation completed","Evaluation in progress","Problem already known, no evaluation necessary","Product not made by company","Evaluation anticipated, but not yet begun","Product discarded -- unable to follow up","Product received in condition which made analysis impossible","Product remains implanted -- unable to follow up","Product unavailable for follow up investigation","Product under quarantine -- unable to follow up","Product under recall/corrective action","Other"};
						validVersionDescriptions[HL7Version.v25] = new string[]{"Evaluation completed","Evaluation in progress","Problem already known, no evaluation necessary","Product not made by company","Evaluation anticipated, but not yet begun","Product discarded -- unable to follow up","Product received in condition which made analysis impossible","Product remains implanted -- unable to follow up","Product unavailable for follow up investigation","Product under quarantine -- unable to follow up","Product under recall/corrective action","Other"};
						validVersionDescriptions[HL7Version.v251] = new string[]{"Evaluation completed","Evaluation in progress","Problem already known, no evaluation necessary","Product not made by company","Evaluation anticipated, but not yet begun","Product discarded -- unable to follow up","Product received in condition which made analysis impossible","Product remains implanted -- unable to follow up","Product unavailable for follow up investigation","Product under quarantine -- unable to follow up","Product under recall/corrective action","Other"};
						validVersionDescriptions[HL7Version.v26] = new string[]{"Evaluation completed","Evaluation in progress","Problem already known, no evaluation necessary","Product not made by company","Evaluation anticipated, but not yet begun","Product discarded -- unable to follow up","Product received in condition which made analysis impossible","Product remains implanted -- unable to follow up","Product unavailable for follow up investigation","Product under quarantine -- unable to follow up","Product under recall/corrective action","Other"};
						validVersionDescriptions[HL7Version.v27] = new string[]{"Evaluation completed","Evaluation in progress","Problem already known, no evaluation necessary","Product not made by company","Evaluation anticipated, but not yet begun","Product discarded -- unable to follow up","Product received in condition which made analysis impossible","Product remains implanted -- unable to follow up","Product unavailable for follow up investigation","Product under quarantine -- unable to follow up","Product under recall/corrective action","Other"};
			            

        }

        
        public override ValidationIssue[] RunRule(string name, object owningObject, object value)
        {
            //todo: check if the value is valid in the current version
            //if the value is not valid in the current version, add it as a validation issue


            return new ValidationIssue[0];
        }
    }
}
